Skip to content

proof(xmss): bound forgery when the signer tells why signing failed - #910

Merged
tcoratger merged 1 commit into
ethereum:masterfrom
tcoratger:ext23-except-reply
Nov 6, 2026
Merged

tcoratger merged 1 commit into
ethereum:masterfrom
tcoratger:ext23-except-reply

Conversation

@tcoratger

@tcoratger tcoratger commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

leanXMSS gets a corollary of its unforgeability theorem for a signer that replies with its error, so an adversary learns which layer failed.
The adversary's advantage is at most the theorem's bound plus the probability that some signing request fails.
It is a corollary on master's game, not a second game with its own proof.

The problem

In master's game, a failed signing request gets none.
signWith returns Except XmssError Signature, and its only error is noAdmissibleEncoding layer key: a one-time key found no codeword in its 2^32 randomizer trials.
The request fixes the key on each layer, so the full reply leaks one bit: which layer failed.
#843 proposed a second game with this reply, and no bound on it (EXT-23 in the audit tracker).
A corollary of unforgeable covers that game without a second proof.

The idea

Run the adversary behind a reduction to master's game, and compare the two games until the first failure.

  • ReasonAdversary sees the signer's whole result. reasonRun is master's game with that reply. Its log keeps toOption of each result, so Valid and Contains are reused as they are.
  • hideReasons is an adversary of master's game: it runs the ReasonAdversary and answers each none with the bottom layer's error, whichever layer failed.
  • Both games are one adversary with two signing oracles that log the same entries and reply alike unless the result is an error. A new generic lemma, prEvent_logReply_and_not_bad_le in Proofs/LoggedUntilBad.lean, states that case of VCVio's StateT identical-until-bad lemma for handlers that log through WriterT.
  • signingFailure is the probability that the log of the variant game holds a failed request.
reasonForgeAdvantage_le :
  reasonForgeAdvantage adv ≤ forgeAdvantage (hideReasons adv) + signingFailure adv

reasonForgeAdvantage_le_add (q ≥ 1) (hbound : HasHashQueryBound (hideReasons adv) q) :
  reasonForgeAdvantage adv ≤ q / 2^127 + signingFailure adv

The budget is the reduction's run in master's game.
After a failure, the reduction may reply with an error that the adversary never gets in the variant game, so the adversary's own budget does not bound that run.
hideReasons_ignoreReasons shows the hypothesis is not empty: every adversary of master's game, read in the variant game through toOption, keeps master's budget behind the reduction.

Example

The adversary asks for index idx = 70000 and message m.
The bottom key 70000 finds a codeword; then the top key bottomTree 70000 = 1 exhausts its 2^32 trials.

  • Variant game: the reply is error (noAdmissibleEncoding top 1), and the log records (request, none).
  • Master's game behind the reduction: the signer returns none, the log records (request, none), and the adversary reads error (noAdmissibleEncoding bottom 70000).

The logs agree, but the replies differ, so the runs may differ from here on.
The run has a failed request, so signingFailure already counts it.
Without a failure, both oracles return ok σ and the runs are the same.

For reviewers

  • signingFailure is an explicit term, not bounded here. prEvent_findCodeword_none_le bounds one search by exp(-4000) only when all its trial inputs are fresh; in the game the adversary's queries can hit them, unless it cannot know the secret seed. That freshness argument is the next step.
  • The hypothesis is on the reduction's budget, not the adversary's (see above). A bound from the adversary's own budget would need the reduction to stop after a failure. Then the verification of its stand-in forgery costs calls that the theorem's q does not contain.
  • The bound after a common draw, prEvent_bind_le_add, is a corollary of VCVio's prEvent_bind_le_sum_add_of_support.
  • The generic lemmas sit in a neutral module at Proofs/; no Sphincs module is imported, and no definition of the scheme changes.

Checks

  • lake build --wfail on Proofs.LoggedUntilBad, Proofs.Xmss.Unforgeability.Reasons, Proofs.Xmss.Unforgeability, Proofs.Xmss and Proofs.Sphincs: passes (5,562 jobs).
  • lake env lean: Reasons.lean 4.8 s and 2.1 GB, LoggedUntilBad.lean 3.7 s and 1.6 GB.
  • leanchecker replay, one module at a time with LEAN_NUM_THREADS=1 at 8 GB: LoggedUntilBad 4.6 s and 2.7 GB, Reasons 5.5 s and 3.5 GB, Unforgeability 20.7 s and 3.4 GB, no error.
  • #print axioms reasonForgeAdvantage_le_add (a #guard_msgs in Proofs/Xmss/Unforgeability.lean): propext, Classical.choice, Quot.sound.
  • lake exe check-decls Proofs.LoggedUntilBad Proofs.Xmss.Unforgeability: 8,340 declarations, 0 findings.
  • scripts/check_layers.py, scripts/soundness_facts.py --check, scripts/check_lean_layout.py --base and scripts/check_writing.py --base: no findings.

🤖 Generated with Claude Code

In the unforgeability game, a failed signing request gets no signature.
A variant game replies with the signer's whole result, so the adversary
learns which layer found no codeword.

The variant reuses the keys, oracles and winning rule of the game.
A reduction answers each failure with the bottom layer's error, and the
two games agree until the first failure. So the variant's advantage is
at most the reduction's advantage plus the probability that some signing
request fails. With the theorem, that is q / 2^127 plus this probability,
where q bounds the reduction's hash calls.

The failure probability stays an explicit term. Every adversary of the
game, read in the variant, keeps its budget behind the reduction.

A neutral module states the identical-until-bad lemma for two handlers
that log the same entries through a writer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant